package com.itheima.mall.service.oms;

import com.itheima.mall.autoconfig.template.OssTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Service
public class MinioService {
    @Autowired
    private OssTemplate ossTemplate;

    public void upload(MultipartFile file) {
        try {
            ossTemplate.upload(file.getOriginalFilename(),file.getInputStream());
        }catch (IOException e){
            throw new RuntimeException("上传失败");
        }
        return;
    }
}
